package org.zhouhe.vo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.OrderBy;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * ArticleType entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "article_type", catalog = "zpd0t1_db")
public class ArticleType implements java.io.Serializable {

	// Fields

	private static final long serialVersionUID = 8285068301331390519L;
	private Integer articleTypeId;
	private ArticleType articleType;
	private String idPath;
	private String name;
	private String logo;
	private Integer orderId;
	private Integer status;
	private Set<ArticleArticleType> articleArticleTypes = new HashSet<ArticleArticleType>(0);
	private Set<ArticleType> articleTypes = new HashSet<ArticleType>(0);

	// Constructors

	/** default constructor */
	public ArticleType() {
	}

	/** full constructor */
	public ArticleType(ArticleType articleType, String idPath, String name, String logo, Integer orderId, Integer status,
			Set<ArticleArticleType> articleArticleTypes, Set<ArticleType> articleTypes) {
		this.articleType = articleType;
		this.idPath = idPath;
		this.name = name;
		this.logo = logo;
		this.orderId = orderId;
		this.status = status;
		this.articleArticleTypes = articleArticleTypes;
		this.articleTypes = articleTypes;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "article_type_id", unique = true, nullable = false)
	public Integer getArticleTypeId() {
		return this.articleTypeId;
	}

	public void setArticleTypeId(Integer articleTypeId) {
		this.articleTypeId = articleTypeId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "parent_id")
	public ArticleType getArticleType() {
		return this.articleType;
	}

	public void setArticleType(ArticleType articleType) {
		this.articleType = articleType;
	}

	@Column(name = "id_path", length = 256)
	public String getIdPath() {
		return this.idPath;
	}

	public void setIdPath(String idPath) {
		this.idPath = idPath;
	}

	@Column(name = "name", length = 64)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "logo", length = 256)
	public String getLogo() {
		return this.logo;
	}

	public void setLogo(String logo) {
		this.logo = logo;
	}

	@Column(name = "order_id")
	public Integer getOrderId() {
		return this.orderId;
	}

	public void setOrderId(Integer orderId) {
		this.orderId = orderId;
	}

	@Column(name = "status")
	public Integer getStatus() {
		return this.status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "articleType")
	public Set<ArticleArticleType> getArticleArticleTypes() {
		return this.articleArticleTypes;
	}

	public void setArticleArticleTypes(Set<ArticleArticleType> articleArticleTypes) {
		this.articleArticleTypes = articleArticleTypes;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "articleType")
	@OrderBy("articleTypeId")
	public Set<ArticleType> getArticleTypes() {
		return this.articleTypes;
	}

	public void setArticleTypes(Set<ArticleType> articleTypes) {
		this.articleTypes = articleTypes;
	}

}